<?php 
//session_start();
//cahnge can be done only by admin

if (!isset($coursenumber)) {
	echo "<h3> Enter course number. </h3>";
	return;
}

$isAdmin = true;  // true - admin; false -  user
//$isStudent = true;  // true - student; false - faculty


// DB connect  
require "config.php";
$con = mysql_connect("localhost",$db_user ,$db_pass);
if (!$con){
	die('Could not connect: ' . mysql_error());
}
mysql_select_db($db_name, $con);


// Get the course details from db
$sql_read =  "SELECT * FROM Course WHERE courseNumber = \"$coursenumber\"";
//echo $sql_read;
$result = mysql_query($sql_read);
while($row = mysql_fetch_array($result)) {
	$cName = $row["courseName"];
	$cNumber = $row["courseNumber"];
	$cId= $row["courseId"]; //unique key
	$deptId= $row["departmentId"];
	//$cTerm= $row["currentTerm"];
	break;
}


mysql_close($con);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<title>Display/Edit Course Information </title>
</head>
<style>
  html {
        overflow: scroll; 
      }
.scrollable{
   overflow: auto;
   width: 70px; /* adjust this width depending to amount of text to display */
   height: 80px; /* adjust height depending on number of options to display */
   border: 1px silver solid;
 }
body{background-image:url('Images/sjsu logo.jpg');
background-repeat: no-repeat;
  background position: top center;
  background-size: 100%;
  background-size: 1400px 1200px;
  position:relative;}
  
h3.pos_fixed{
color:#6D63A9;
position:relative;
top:25px;
left:30px;
}
#b{
position:relative;
top:140px;
left:320px;
}

a:link    {
  /* Applies to all unvisited links */
  text-decoration:  none;
  font-weight:      bold;
  color:          "#blue";
  font-size:120%;
  } 

</style>

<div id="c"><font size="4" color=#4B5992><b>Course Information</b></font></div><br>
<form action="UpdateCourseInfoProcess.php" method="POST">
<input type="hidden" name="cId" value="<?php echo $cId?>" \>
<table>
	<tr><td><div id="e"><font size="4" color=#4B5992> Course Id: </td> <td> <label><?php echo $cId?></label> </td></tr>
	<tr><td><div id="f"><font size="4" color=#4B5992> Course Name: </td> <td> <input type="text" name="CName" value="<?php echo $cName?>" />  </td></tr>
	<tr><td><div id="g"><font size="4" color=#4B5992>Course Number: </td> <td> <input type="text" name="CNumber" value="<?php echo $cNumber?>" />  </td></tr>
	<tr><td><div id="h"><font size="4" color=#4B5992> Department Id: </td> <td> <label> <?php echo $deptId?></label></td></tr>
<!--  	<tr><td><div id="i"><font size="4" color=#4B5992> Current Term: </td> <td> <label> <?php echo $cTerm?></label></td></tr>-->

</table>


<div id="k"><font size="4" color=#4B5992><input type="submit" value="Save" id="submit" />
</form>
</html>